package pri.hillchen.std.design.pattern.single;

/**
 * Created by hillchen on 2018/3/7.
 */
public class LazyInner {
    private LazyInner(){

    }
    private static class LazyInnerBulider{
        private static final LazyInner lazyInner = new LazyInner();
    }

    /**
     * 内部构建器只有当执行了getInstance方法时才会被类加载器加载进来，
     * 而内部类的lazyInner是LazyInnerBulider的全局常量，所以lazyInner也是单例的。
     * 所以这种方法是一个
     * @return
     */
    public static LazyInner getInstance(){
        return LazyInnerBulider.lazyInner;
    }
}
